package com.amazon.inapp.purchasing;

final class ImplementationFactory
{
  private static volatile ImplementationRegistry IMPLEMENTATION_REGISTRY;
  private static volatile boolean IS_SANDBOX_MODE;
  private static volatile boolean IS_SANDBOX_MODE_CHECKED;
  private static volatile LogHandler LOG_HANDLER_INSTANCE;
  private static volatile RequestHandler REQUEST_HANDLER_INSTANCE;
  private static volatile ResponseHandler RESPONSE_HANDLER_INSTANCE;

  private static ImplementationRegistry getImplementationRegistry()
  {
    if (IMPLEMENTATION_REGISTRY == null);
    try
    {
      if (IMPLEMENTATION_REGISTRY == null)
        if (!isSandboxMode())
          break label38;
      label38: for (IMPLEMENTATION_REGISTRY = new SandboxImplementationRegistry(); ; IMPLEMENTATION_REGISTRY = new KiwiImplementationRegistry())
        return IMPLEMENTATION_REGISTRY;
    }
    finally
    {
    }
  }

  // ERROR //
  private static <T> T getInstance(Class<T> paramClass, T paramT)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnonnull +42 -> 43
    //   4: ldc 2
    //   6: monitorenter
    //   7: aload_1
    //   8: ifnonnull +20 -> 28
    //   11: invokestatic 39	com/amazon/inapp/purchasing/ImplementationFactory:getImplementationRegistry	()Lcom/amazon/inapp/purchasing/ImplementationRegistry;
    //   14: aload_0
    //   15: invokeinterface 45 2 0
    //   20: invokevirtual 51	java/lang/Class:newInstance	()Ljava/lang/Object;
    //   23: astore 4
    //   25: aload 4
    //   27: astore_1
    //   28: ldc 2
    //   30: monitorexit
    //   31: aload_1
    //   32: areturn
    //   33: astore_2
    //   34: ldc 2
    //   36: monitorexit
    //   37: aload_2
    //   38: athrow
    //   39: astore_3
    //   40: goto -12 -> 28
    //   43: aload_1
    //   44: areturn
    //
    // Exception table:
    //   from	to	target	type
    //   11	25	33	finally
    //   28	31	33	finally
    //   34	37	33	finally
    //   11	25	39	java/lang/Exception
  }

  static LogHandler getLogHandler()
  {
    if (LOG_HANDLER_INSTANCE != null)
      return LOG_HANDLER_INSTANCE;
    return (LogHandler)getInstance(LogHandler.class, LOG_HANDLER_INSTANCE);
  }

  static RequestHandler getRequestHandler()
  {
    if (REQUEST_HANDLER_INSTANCE != null)
      return REQUEST_HANDLER_INSTANCE;
    return (RequestHandler)getInstance(RequestHandler.class, REQUEST_HANDLER_INSTANCE);
  }

  static ResponseHandler getResponseHandler()
  {
    if (RESPONSE_HANDLER_INSTANCE != null)
      return RESPONSE_HANDLER_INSTANCE;
    return (ResponseHandler)getInstance(ResponseHandler.class, RESPONSE_HANDLER_INSTANCE);
  }

  static boolean isSandboxMode()
  {
    if (IS_SANDBOX_MODE_CHECKED)
      return IS_SANDBOX_MODE;
    try
    {
      if (IS_SANDBOX_MODE_CHECKED)
      {
        boolean bool = IS_SANDBOX_MODE;
        return bool;
      }
    }
    finally
    {
    }
    try
    {
      ImplementationFactory.class.getClassLoader().loadClass("com.amazon.android.Kiwi");
      IS_SANDBOX_MODE = false;
      IS_SANDBOX_MODE_CHECKED = true;
      return IS_SANDBOX_MODE;
    }
    catch (Throwable localThrowable)
    {
      while (true)
        IS_SANDBOX_MODE = true;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.amazon.inapp.purchasing.ImplementationFactory
 * JD-Core Version:    0.6.2
 */